home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Belgian Amiga Club - ADF Collection
/
BS1 part 43.zip
/
CU Amiga 13.adf
/
T
/
ed-backup
Wrap
Text File
|
2000-08-15
|
7KB
|
213 lines
**********************************************************************
* *
* LOADER ROUTINE FOR AMIGA ARMY MOVES *
* *
***********************************************************************
xref screens,stack,game,download
include "equates"
start: move.w #$07f0,custom+dmacon ;7f0
lea stack,a7 ;setup stack pointer
lea blacks,a1
bsr setcol
lea normcop,a0
lea download,a1
moveq #9,d0
sue: move.l (a0)+,(a1)+
dbf d0,sue
setupscr: lea custom,a0
move.w #$0000,bpl1mod(a0) ;only 40 chars accross
move.w #$0000,bpl2mod(a0) ;
move.w #$4200,bplcon0(a0)
move.w #$0000,bplcon1(a0)
move.w #$0064,bplcon2(a0)
move.w #$0038,ddfstrt(a0)
move.w #$00d0,ddfstop(a0)
move.w #$2c81,diwstrt(a0)
move.w #$f4c1,diwstop(a0)
move.l #download,cop1lch(a0) ;standard copper
move.w custom+copjmp1,d0
move.w #$7fff,dmacon(a0)
move.w #$87df,dmacon(a0)
bra main
;copper list
;-----------
normcop: dc.w $00e0,screen1/$10000
dc.w $00e2,screen1&$ffff
dc.w $00e4,screen2/$10000
dc.w $00e6,screen2&$ffff
dc.w $00e8,screen3/$10000
dc.w $00ea,screen3&$ffff
dc.w $00ec,screen4/$10000
dc.w $00ee,screen4&$ffff
dc.w $ffff,$fffe
;routine to setup colours to those pointed at by a1
;--------------------------------------------------
setcol: lea custom+color00,a0
moveq #15,d0
oncol: move.w (a1)+,(a0)+
dbf d0,oncol
rts
chicken: lea custom+color00,a0
move.w (a0),d0
addi.w #$01,d0
andi.w #$fff,d0
move.w d0,(a0)
bra chicken
blacks: ds.w 16
titcols: dc.w $000,$200,$310,$410,$421,$776,$760,$730
dc.w $432,$321,$112,$223,$334,$445,$557,$500
;main routine to handle loader
;-----------------------------
main: bsr lob_screen_up
lea titcols,a1
bsr setcol
bsr load_it_in
move.w #$4000,custom+intena
bsr relocater
bra set_download
;routine to lob degas picture to amiga four colour screen
;--------------------------------------------------------
lob_screen_up: lea screen1,a1
lea screen2,a2
lea screen3,a3
lea screen4,a4
lea top,a0
move.l #3999,d7
agro_loop: move.w (a0)+,(a1)+
move.w (a0)+,(a2)+
move.w (a0)+,(a3)+
move.w (a0)+,(a4)+
dbf d7,agro_loop
rts
*************************************************************************
* *
* loader program *
* *
*************************************************************************
;macro's
;-------
calexec: MACRO
move.l Sysbase,a6
jsr \1(a6)
ENDM
calldos: MACRO
move.l DOSbase,a6
jsr \1(a6)
ENDM
load_it_in: lea dosn,a1
moveq #0,d0
calexec OpenLibrary
move.l d0,DOSbase
move.l #mode_oldfile,d2
move.l #fname,d1
calldos Open
move.l d0,filehandle
tst.l d0
beq error
move.l d0,d1
move.l #game,d2
move.l #$6ffff,d3
calldos Read
tst.l d0
bmi error
move.l filehandle,d1
calldos Close
rts
error: move.w #$0fff,$dff180
bra error
;----------------------------------------------------------------------
; marcs amazing relocation routine
;----------------------------------------------------------------------
hunk2_start: equ $3dc00 ;this is where the bss will sit
hunk1_start: equ $2000 ;this is where the program will sit
old_code: equ game+$24 ;where code now sits
hunk_info: equ game+$3bb7c ;relocation information
relocater: lea hunk_info+4,a2 ;where the first addresses start
move.l #hunk1_start,d0 ;start object address of hunk 1
lea old_code,a1
move.l (a2)+,d7
adda.l #4,a2 ;skip over hunk number
subi.l #$01,d7
bsr relocate_hunk ;relocates to be done
move.l (a2)+,d7 ;do next hunk
subi.l #$01,d7
adda.l #4,a2
move.l #hunk2_start,d0 ;start object address of hunk 2
bsr relocate_hunk
rts
relocate_hunk: move.l (a2)+,d1 ;get relocate offset
move.l a1,a3
adda.l d1,a3 ;points a3 to long to modify
add.l d0,(a3) ;adds hunk base address
dbf d7,relocate_hunk
rts
;routine that has to be sent to 'download' buffer
;------------------------------------------------
set_download: lea downloader,a0
lea $7ff00,a1
moveq #99,d7
sdownlp: move.w (a0)+,(a1)+
dbf d7,sdownlp
jmp $7ff00
downloader: lea hunk1_start,a0
lea old_code,a1
move.l #$eed8,d0
trx_loop: move.l (a1)+,(a0)+
subi.l #$01,d0
bne trx_loop
jmp hunk1_start
;information for system calls
;-----------------------------
Sysbase: equ 4
OpenLibrary: equ -552
Close: equ -36
Read: equ -42
Open: equ -30
mode_oldfile: equ 1005
filehandle: dc.l 0
DOSbase: dc.l 0
fname: dc.b 'df0:out',0
dosn: dc.b 'dos.library',0
screen1: equ $78200
screen2: equ $7a140
screen3: equ $7c080
screen4: equ $7dfc0
include 'pic1.mac'
include 'pic2.mac'
END